package com.tencreat.mapper.mall;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.tencreat.domain.mall.MallGoods;
import com.tencreat.domain.mall.dto.MallGoodsSearchDTO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;

/**
 * 商城商品基本信息Mapper接口
 *
 * @author tencreat
 * @date 2021-08-13
 */
@Repository
public interface MallGoodsMapper extends BaseMapper<MallGoods> {
    List<MallGoods> selectOrderList(MallGoods mallGoods);

    /**
     * 锁商品
     * @param id 商品ID
     * @return 返回结果
     */
    MallGoods selectForUpdateById(Long id);

    List<MallGoods> getByOrderSn(@Param("orderSn") String orderSn);

    HashMap<String, BigDecimal> getGoodPrice(@Param("goodsId")Long goodsId, @Param("normsId")Long normsId);

    IPage<MallGoods> getApiList(@Param("mallGoodsSearchPo") MallGoodsSearchDTO mallGoodsSearchPo, @Param("page")IPage<MallGoods> page);

    void updateIsOnSaleByCategory(@Param("isOnSale") String isOnSale,@Param("categoryId") Long categoryId);

    IPage<MallGoods> recommendList(@Param("mallGoodsSearchPo") MallGoodsSearchDTO mallGoodsSearchPo, IPage<MallGoods> mallGoodsIPage);

    List<MallGoods> supplierChainGoods();

    // IPage<MallGoods> getApiStoreList(MallGoodsSearchDTO mallGoodsSearchPo, IPage<MallGoods> mallGoodsIPage);
}
